package com.situ.day23.singleton;

//懒汉式
public class Singleton2 {
    private static Singleton2 INSTANCE;

    private Singleton2() {
        System.out.println("Singleton2.Singleton2");
    }

    public synchronized static Singleton2 getInstance() {
        if (INSTANCE == null) {
            INSTANCE = new Singleton2();
        }
        return INSTANCE;
    }

}
